#include <iostream>
#include "comm.hpp"

using namespace std;

int main()
{
    string query_string;
    GetQueryString(query_string);
    // a=100&b=200

    string str1;
    string str2;
    CutString(query_string, "&", str1, str2);

    string name1;
    string value1;
    CutString(str1, "=", name1, value1);

    string name2;
    string value2;
    CutString(str2, "=", name2, value2);

    // 1 ->
    cout << name1 << " : " << value1 << endl;
    cout << name2 << " : " << value2 << endl;

    // 2
    cerr << name1 << " : " << value1 << endl;
    cerr << name2 << " : " << value2 << endl;
    int x = atoi(value1.c_str());
    int y = atoi(value2.c_str());

    // 可能向进行某种计算(计算，搜索，登陆等)，想进行某种存储(注册)
    cout << "<html>";
    cout << "<head><meta charset=\"utf-8\"></head>";
    cout << "<body>";
    cout << "<h3> " << value1 << " + " << value2 << " = " << x + y << "</h3>";
    cout << "<h3> " << value1 << " - " << value2 << " = " << x - y << "</h3>";
    cout << "<h3> " << value1 << " * " << value2 << " = " << x * y << "</h3>";
    cout << "<h3> " << value1 << " / " << value2 << " = " << x / y << "</h3>";
    cout << "</body>";
    cout << "</html>";
    return 0;
}
